﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Weixin.BLL;
using Weixin.Utils;
using Weixin.BLL.ChinaTax;
using Weixin.Entity.ChinaTax;

namespace Weixin.Web
{
    public partial class Person_txt : System.Web.UI.Page
    {
        protected personEntity _PersonEntity;
        int _Id;
        #region jssdk
        protected string noncestr = string.Empty;
        protected string jsapi_ticket = string.Empty;
        protected string timestamp = string.Empty;
        protected string signature = string.Empty;

        protected string url = string.Empty;
        protected string title = string.Empty;
        protected string desc = string.Empty;
        #endregion
        protected void Page_Load(object sender, EventArgs e)
        {
            int.TryParse(Request.QueryString["id"], out _Id);
            if (_Id > 0)
            {
                GetData();
                GetJssdk();
            }
        }

        protected void GetJssdk()
        {
            WX wx = new WX();
            url = Request.Url.ToString().IndexOf("#") > -1 ? Request.Url.ToString().Substring(0, Request.Url.ToString().IndexOf("#")) : Request.Url.ToString();
            string[] arr = wx.GetJSSDK(url);
            noncestr = arr[0];
            jsapi_ticket = arr[1];
            timestamp = arr[2];
            signature = arr[3];
            title = _PersonEntity.name + "-中国税务咨询师";
            desc = "最权威税务第一门户网站,最专业税务咨询网站";
        }

        private void GetData()
        {
            personBLL bll = personBLL.GetInstance();
            _PersonEntity = bll.GetAdminSingle(_Id);
        }
    }
}